<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@include file="/common.jsp" %>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>订单</title>
	<script type="text/javascript">
		$(function(){
			$('#announceList').datagrid({
				title:'订单',
				iconCls:'icon-save',
				fit:true,//自动大小   
				height: 'auto',
				nowrap: false,
				striped: true,
				singleSelect:true,//只允许选中一行
				collapsible:false,//是否可折叠的  
				loadMsg:'正在加载数据……',
				url:'${webRoot}/sample/selectGrid.action',
			    idField:'pkid',
				frozenColumns:[[
	                {field:'ck',checkbox:true}
				]],
				pagination:true,
				pageList:[10,20,25,30,50],
				rownumbers:true,
				toolbar:['-'],
				onLoadSuccess: function () {
				    $('.datagrid-toolbar').append($('#searchBar'));
				    $('#searchBar').show();
				},
				showFooter:true,
				selectOnCheck:false
			});
			var p = $('#announceList').datagrid('getPager');
			if (p){
				$(p).pagination({
					displayMsg:'当前显示从{from}到{to}共{total}条记录',
					onBeforeRefresh:function(){
						//alert('before refresh');
					}
				});
			}
		});
		function resize(){
			$('#announceList').datagrid('resize', {
				width:700,
				height:400
			});
		}

		function doSearch(){   
		    $('#announceList').datagrid('load',{   
		        "merchantName": $('#announceName').val(),   
		        "phone": $('#announceContent').val()  
		    });   
		}
		function formate(value,rec){
			return '<a href="javascript:detail()"><span style="color:red;padding-left:20px;" class="icon-edit">详细</span></a>';
		}

		function detail(){
			var announce = $('#announceList').datagrid('getSelected');
			$('#name').val(announce.name);
			$('#content').html(announce.content);
			$('#w').window('open');
		}
	</script>
</head>
<body style="overfolw：auto;width:98%;height: 95%;background-color: white;">
	<table id="announceList" height="auto" style="line-height: 30px;">
		<thead>   
      		 <th field="merchantName" width="250" sortable="true">商户名称</th>   
	            <th field="phone" width="150">手机号</th>   
	            <th field="merchantId" width="100" >商户号</th>   
	            <th field="amount" width="100" >总金额</th>   
	            <th field="opt" width="100" formatter="formate">详细</th>   
       		 </tr>   
   		 </thead>   
	</table>
	<div id="searchBar" style="padding:3px;display:none;">  
	    <span>商户名称:</span>  
	    <input id="announceName" style="line-height:18px;border:1px solid #ccc">  
	    <span>手机号:</span>  
	    <input id="announceContent" style="line-height:18px;border:1px solid #ccc">  
	    <a href="#"  class="easyui-linkbutton" iconCls="icon-search" onclick="doSearch()">Search</a>  
   </div>  
</body>
</html>